<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="职员内码" prop="dzyid">
        <el-input
          v-model="queryParams.dzyid"
          placeholder="请输入职员内码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="职员编号" prop="dzycode">
        <el-input
          v-model="queryParams.dzycode"
          placeholder="请输入职员编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="职员名称" prop="dzyname">
        <el-input
          v-model="queryParams.dzyname"
          placeholder="请输入职员名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="注册名" prop="lgnname">
        <el-input
          v-model="queryParams.lgnname"
          placeholder="请输入注册名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="上级部门" prop="shjbumen">
        <el-input
          v-model="queryParams.shjbumen"
          placeholder="请输入上级部门"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否活动" prop="beactive">
        <el-select v-model="queryParams.beactive" placeholder="请选择是否活动" clearable>
          <el-option
            v-for="dict in dict.type.flow_beactive_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="出生日期" prop="csrq">
        <el-input
          v-model="queryParams.csrq"
          placeholder="请输入出生日期"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="年龄" prop="aged">
        <el-input
          v-model="queryParams.aged"
          placeholder="请输入年龄"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="身份证号" prop="idcard">
        <el-input
          v-model="queryParams.idcard"
          placeholder="请输入身份证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="性别" prop="sexid">
        <el-input
          v-model="queryParams.sexid"
          placeholder="请输入性别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="民族" prop="rsmz">
        <el-input
          v-model="queryParams.rsmz"
          placeholder="请输入民族"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="电话号码" prop="telephoneno">
        <el-input
          v-model="queryParams.telephoneno"
          placeholder="请输入电话号码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="政治面貌" prop="rszhzhmm">
        <el-input
          v-model="queryParams.rszhzhmm"
          placeholder="请输入政治面貌"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="电子邮箱" prop="rsmail">
        <el-input
          v-model="queryParams.rsmail"
          placeholder="请输入电子邮箱"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="籍贯" prop="rsjg">
        <el-input
          v-model="queryParams.rsjg"
          placeholder="请输入籍贯"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="婚姻状况" prop="rshyzhk">
        <el-input
          v-model="queryParams.rshyzhk"
          placeholder="请输入婚姻状况"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['flow:staff:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['flow:staff:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['flow:staff:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['flow:staff:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="staffList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="职员内码" align="center" prop="dzyid" />
      <el-table-column label="职员编号" align="center" prop="dzycode" />
      <el-table-column label="职员名称" align="center" prop="dzyname" />
      <el-table-column label="助记码" align="center" prop="zjm" />
      <el-table-column label="口令" align="center" prop="kl" />
      <el-table-column label="注册名" align="center" prop="lgnname" />
      <el-table-column label="上级部门" align="center" prop="shjbumen" />
      <el-table-column label="是否活动" align="center" prop="beactive">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.flow_beactive_status" :value="scope.row.beactive"/>
        </template>
      </el-table-column>
      <el-table-column label="是否销售员" align="center" prop="issp" />
      <el-table-column label="是否收款员" align="center" prop="isSky" />
      <el-table-column label="是否操作员" align="center" prop="isCzy" />
      <el-table-column label="是否业务员" align="center" prop="isYwy" />
      <el-table-column label="是否备货员" align="center" prop="isBhy" />
      <el-table-column label="出生日期" align="center" prop="csrq" />
      <el-table-column label="年龄" align="center" prop="aged" />
      <el-table-column label="身份证号" align="center" prop="idcard" />
      <el-table-column label="职务" align="center" prop="zyzw" />
      <el-table-column label="职称" align="center" prop="zyzc" />
      <el-table-column label="专业" align="center" prop="zyzy" />
      <el-table-column label="性别" align="center" prop="sexid" />
      <el-table-column label="传呼" align="center" prop="callnum" />
      <el-table-column label="家庭电话" align="center" prop="zyphone" />
      <el-table-column label="家庭地址" align="center" prop="zyaddress" />
      <el-table-column label="毕业时间" align="center" prop="bysj" />
      <el-table-column label="结业学校" align="center" prop="byxx" />
      <el-table-column label="备注" align="center" prop="beizhu" />
      <el-table-column label="是否结算员" align="center" prop="isJsy" />
      <el-table-column label="英文名称" align="center" prop="enname" />
      <el-table-column label="曾用名" align="center" prop="cengyongming" />
      <el-table-column label="部门内码" align="center" prop="bmid" />
      <el-table-column label="工作地点" align="center" prop="rsgzdd" />
      <el-table-column label="成本中心" align="center" prop="rschbzhx" />
      <el-table-column label="级别" align="center" prop="rsjb" />
      <el-table-column label="纳税地点" align="center" prop="rsnshdd" />
      <el-table-column label="民族" align="center" prop="rsmz" />
      <el-table-column label="身高" align="center" prop="rsshg" />
      <el-table-column label="体重" align="center" prop="rstzh" />
      <el-table-column label="血型" align="center" prop="rsxx" />
      <el-table-column label="最高学历" align="center" prop="rszgxl" />
      <el-table-column label="电话号码" align="center" prop="telephoneno" />
      <el-table-column label="分机号" align="center" prop="rsfjh" />
      <el-table-column label="政治面貌" align="center" prop="rszhzhmm" />
      <el-table-column label="宗教信仰" align="center" prop="rszjxy" />
      <el-table-column label="其它联系方式" align="center" prop="rsqtlxfsh" />
      <el-table-column label="内部电子邮箱" align="center" prop="rsnbmail" />
      <el-table-column label="电子邮箱" align="center" prop="rsmail" />
      <el-table-column label="参加工作时间" align="center" prop="rscjgzshj" />
      <el-table-column label="进本企业时间" align="center" prop="rsjbqyshj" />
      <el-table-column label="身份" align="center" prop="rsshf" />
      <el-table-column label="户口性质" align="center" prop="rshkxzh" />
      <el-table-column label="籍贯" align="center" prop="rsjg" />
      <el-table-column label="入团时间" align="center" prop="rsrtshj" />
      <el-table-column label="入党时间" align="center" prop="rsrdshj" />
      <el-table-column label="党派" align="center" prop="rsdp" />
      <el-table-column label="档案编号" align="center" prop="rsdabh" />
      <el-table-column label="紧急联系电话" align="center" prop="rsjjlxdh" />
      <el-table-column label="特长" align="center" prop="rstch" />
      <el-table-column label="个人喜好" align="center" prop="rsgrxh" />
      <el-table-column label="婚姻状况" align="center" prop="rshyzhk" />
      <el-table-column label="简历" align="center" prop="rsjl" />
      <el-table-column label="离职日期" align="center" prop="rslzrq" />
      <el-table-column label="离职原因" align="center" prop="rslzyy" />
      <el-table-column label="相片" align="center" prop="rsxp" />
      <el-table-column label="状态" align="center" prop="rszht" />
      <el-table-column label="岗位内码" align="center" prop="gwid" />
      <el-table-column label="驾驶证档案号" align="center" prop="Rsjshzhid" />
      <el-table-column label="准驾车型" align="center" prop="Rszhjchx" />
      <el-table-column label="驾驶证初领日期" align="center" prop="Rsjshzhchlrq" />
      <el-table-column label="驾驶证有效日期" align="center" prop="Rsjshzhyxrq" />
      <el-table-column label="驾驶证审验日期" align="center" prop="Rsjshzhshyrq" />
      <el-table-column label="是否发工资" align="center" prop="isGz" />
      <el-table-column label="最后更新时间" align="center" prop="lastmodifytime" />
      <el-table-column label="户口性质" align="center" prop="hkxzh" />
      <el-table-column label="户口所在地" align="center" prop="hkszd" />
      <el-table-column label="对方标识" align="center" prop="duifbsh" />
      <el-table-column label="职员类型" align="center" prop="ClerkType" />
      <el-table-column label="工资发放比例" align="center" prop="PerSalary" />
      <el-table-column label="试用期结束日期" align="center" prop="ProbEndDate" />
      <el-table-column label="试用期开始日期" align="center" prop="ProbStartDate" />
      <el-table-column label="试用期类型" align="center" prop="ProbType" />
      <el-table-column label="紧急联系人" align="center" prop="rsjjlxr" />
      <el-table-column label="介绍人" align="center" prop="rsjshr" />
      <el-table-column label="与介绍人关系" align="center" prop="rsjshrgx" />
      <el-table-column label="调分公司时间" align="center" prop="ToBranchTime" />
      <el-table-column label="职级id 标识ZHJ" align="center" prop="zhjid" />
      <el-table-column label="职务id" align="center" prop="zhwid" />
      <el-table-column label="简历编号" align="center" prop="zpjlbh" />
      <el-table-column label="使用随机密码" align="center" prop="sysjmm" />
      <el-table-column label="已上交" align="center" prop="yishj" />
      <el-table-column label="是否变动" align="center" prop="isBiand" />
      <el-table-column label="文化程度" align="center" prop="culture" />
      <el-table-column label="是否拣货员" align="center" prop="isJhy" />
      <el-table-column label="是否主动补货" align="center" prop="isSj" />
      <el-table-column label="是否送货" align="center" prop="isSongh" />
      <el-table-column label="PDA密码" align="center" prop="pdamm" />
      <el-table-column label="是否变动_临时字段" align="center" prop="isBiandTmp" />
      <el-table-column label="仅使用指纹" align="center" prop="onlyfinger" />
      <el-table-column label="部门名称" align="center" prop="bm" />
      <el-table-column label="收款员余额" align="center" prop="shkyye" />
      <el-table-column label="折扣范围" align="center" prop="zkscope" />
      <el-table-column label="是否保管员" align="center" prop="isbgy" />
      <el-table-column label="是否复核/检验" align="center" prop="isfhjy" />
      <el-table-column label="应收余额" align="center" prop="yshye" />
      <el-table-column label="销售信贷额" align="center" prop="xsxde" />
      <el-table-column label="销售信贷期" align="center" prop="xdqxx" />
      <el-table-column label="复核台号" align="center" prop="fhth" />
      <el-table-column label="是否复核员" align="center" prop="isFhy" />
      <el-table-column label="是否PDA操作员" align="center" prop="isPda" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handlePicture(scope.row)"
            v-hasPermi="['system:pictures:edit']"
          >图片管理</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['flow:staff:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['flow:staff:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 图片管理弹窗   -->
    <el-dialog :title="title" :visible.sync="open2" width="500px" append-to-body>
      <el-form ref="form" :model="form2" :rules="rules2" label-width="80px">
        <el-form-item label="分类" prop="noticeType">
          <el-select v-model="queryParamsPic.noticeType" placeholder="请选择图片分类" clearable @change="picFlClick">
            <el-option
              v-for="dictA in dictA"
              :key="dictA.value"
              :label="dictA.label"
              :value="dictA.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="图片附件" prop="piclink">
          <image-upload v-model="form2.picUrl"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm2">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 添加或修改职员信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="职员编号" prop="dzycode">
          <el-input v-model="form.dzycode" placeholder="请输入职员编号" />
        </el-form-item>
        <el-form-item label="职员名称" prop="dzyname">
          <el-input v-model="form.dzyname" placeholder="请输入职员名称" />
        </el-form-item>
        <el-form-item label="助记码" prop="zjm">
          <el-input v-model="form.zjm" placeholder="请输入助记码" />
        </el-form-item>
        <el-form-item label="口令" prop="kl">
          <el-input v-model="form.kl" placeholder="请输入口令" />
        </el-form-item>
        <el-form-item label="注册名" prop="lgnname">
          <el-input v-model="form.lgnname" placeholder="请输入注册名" />
        </el-form-item>
        <el-form-item label="上级部门" prop="shjbumen">
          <el-input v-model="form.shjbumen" placeholder="请输入上级部门" />
        </el-form-item>
        <el-form-item label="是否活动" prop="beactive">
          <el-select v-model="form.beactive" placeholder="请选择是否活动">
            <el-option
              v-for="dict in dict.type.flow_beactive_status"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否销售员" prop="issp">
          <el-input v-model="form.issp" placeholder="请输入是否销售员" />
        </el-form-item>
        <el-form-item label="是否收款员" prop="isSky">
          <el-input v-model="form.isSky" placeholder="请输入是否收款员" />
        </el-form-item>
        <el-form-item label="是否操作员" prop="isCzy">
          <el-input v-model="form.isCzy" placeholder="请输入是否操作员" />
        </el-form-item>
        <el-form-item label="是否业务员" prop="isYwy">
          <el-input v-model="form.isYwy" placeholder="请输入是否业务员" />
        </el-form-item>
        <el-form-item label="是否备货员" prop="isBhy">
          <el-input v-model="form.isBhy" placeholder="请输入是否备货员" />
        </el-form-item>
        <el-form-item label="出生日期" prop="csrq">
          <el-input v-model="form.csrq" placeholder="请输入出生日期" />
        </el-form-item>
        <el-form-item label="年龄" prop="aged">
          <el-input v-model="form.aged" placeholder="请输入年龄" />
        </el-form-item>
        <el-form-item label="身份证号" prop="idcard">
          <el-input v-model="form.idcard" placeholder="请输入身份证号" />
        </el-form-item>
        <el-form-item label="职务" prop="zyzw">
          <el-input v-model="form.zyzw" placeholder="请输入职务" />
        </el-form-item>
        <el-form-item label="职称" prop="zyzc">
          <el-input v-model="form.zyzc" placeholder="请输入职称" />
        </el-form-item>
        <el-form-item label="专业" prop="zyzy">
          <el-input v-model="form.zyzy" placeholder="请输入专业" />
        </el-form-item>
        <el-form-item label="性别" prop="sexid">
          <el-input v-model="form.sexid" placeholder="请输入性别" />
        </el-form-item>
        <el-form-item label="传呼" prop="callnum">
          <el-input v-model="form.callnum" placeholder="请输入传呼" />
        </el-form-item>
        <el-form-item label="家庭电话" prop="zyphone">
          <el-input v-model="form.zyphone" placeholder="请输入家庭电话" />
        </el-form-item>
        <el-form-item label="家庭地址" prop="zyaddress">
          <el-input v-model="form.zyaddress" placeholder="请输入家庭地址" />
        </el-form-item>
        <el-form-item label="毕业时间" prop="bysj">
          <el-input v-model="form.bysj" placeholder="请输入毕业时间" />
        </el-form-item>
        <el-form-item label="结业学校" prop="byxx">
          <el-input v-model="form.byxx" placeholder="请输入结业学校" />
        </el-form-item>
        <el-form-item label="备注" prop="beizhu">
          <el-input v-model="form.beizhu" placeholder="请输入备注" />
        </el-form-item>
        <el-form-item label="是否结算员" prop="isJsy">
          <el-input v-model="form.isJsy" placeholder="请输入是否结算员" />
        </el-form-item>
        <el-form-item label="英文名称" prop="enname">
          <el-input v-model="form.enname" placeholder="请输入英文名称" />
        </el-form-item>
        <el-form-item label="曾用名" prop="cengyongming">
          <el-input v-model="form.cengyongming" placeholder="请输入曾用名" />
        </el-form-item>
        <el-form-item label="部门内码" prop="bmid">
          <el-input v-model="form.bmid" placeholder="请输入部门内码" />
        </el-form-item>
        <el-form-item label="工作地点" prop="rsgzdd">
          <el-input v-model="form.rsgzdd" placeholder="请输入工作地点" />
        </el-form-item>
        <el-form-item label="成本中心" prop="rschbzhx">
          <el-input v-model="form.rschbzhx" placeholder="请输入成本中心" />
        </el-form-item>
        <el-form-item label="级别" prop="rsjb">
          <el-input v-model="form.rsjb" placeholder="请输入级别" />
        </el-form-item>
        <el-form-item label="纳税地点" prop="rsnshdd">
          <el-input v-model="form.rsnshdd" placeholder="请输入纳税地点" />
        </el-form-item>
        <el-form-item label="民族" prop="rsmz">
          <el-input v-model="form.rsmz" placeholder="请输入民族" />
        </el-form-item>
        <el-form-item label="身高" prop="rsshg">
          <el-input v-model="form.rsshg" placeholder="请输入身高" />
        </el-form-item>
        <el-form-item label="体重" prop="rstzh">
          <el-input v-model="form.rstzh" placeholder="请输入体重" />
        </el-form-item>
        <el-form-item label="血型" prop="rsxx">
          <el-input v-model="form.rsxx" placeholder="请输入血型" />
        </el-form-item>
        <el-form-item label="最高学历" prop="rszgxl">
          <el-input v-model="form.rszgxl" placeholder="请输入最高学历" />
        </el-form-item>
        <el-form-item label="电话号码" prop="telephoneno">
          <el-input v-model="form.telephoneno" placeholder="请输入电话号码" />
        </el-form-item>
        <el-form-item label="分机号" prop="rsfjh">
          <el-input v-model="form.rsfjh" placeholder="请输入分机号" />
        </el-form-item>
        <el-form-item label="政治面貌" prop="rszhzhmm">
          <el-input v-model="form.rszhzhmm" placeholder="请输入政治面貌" />
        </el-form-item>
        <el-form-item label="宗教信仰" prop="rszjxy">
          <el-input v-model="form.rszjxy" placeholder="请输入宗教信仰" />
        </el-form-item>
        <el-form-item label="其它联系方式" prop="rsqtlxfsh">
          <el-input v-model="form.rsqtlxfsh" placeholder="请输入其它联系方式" />
        </el-form-item>
        <el-form-item label="内部电子邮箱" prop="rsnbmail">
          <el-input v-model="form.rsnbmail" placeholder="请输入内部电子邮箱" />
        </el-form-item>
        <el-form-item label="电子邮箱" prop="rsmail">
          <el-input v-model="form.rsmail" placeholder="请输入电子邮箱" />
        </el-form-item>
        <el-form-item label="参加工作时间" prop="rscjgzshj">
          <el-input v-model="form.rscjgzshj" placeholder="请输入参加工作时间" />
        </el-form-item>
        <el-form-item label="进本企业时间" prop="rsjbqyshj">
          <el-input v-model="form.rsjbqyshj" placeholder="请输入进本企业时间" />
        </el-form-item>
        <el-form-item label="身份" prop="rsshf">
          <el-input v-model="form.rsshf" placeholder="请输入身份" />
        </el-form-item>
        <el-form-item label="户口性质" prop="rshkxzh">
          <el-input v-model="form.rshkxzh" placeholder="请输入户口性质" />
        </el-form-item>
        <el-form-item label="籍贯" prop="rsjg">
          <el-input v-model="form.rsjg" placeholder="请输入籍贯" />
        </el-form-item>
        <el-form-item label="入团时间" prop="rsrtshj">
          <el-input v-model="form.rsrtshj" placeholder="请输入入团时间" />
        </el-form-item>
        <el-form-item label="入党时间" prop="rsrdshj">
          <el-input v-model="form.rsrdshj" placeholder="请输入入党时间" />
        </el-form-item>
        <el-form-item label="党派" prop="rsdp">
          <el-input v-model="form.rsdp" placeholder="请输入党派" />
        </el-form-item>
        <el-form-item label="档案编号" prop="rsdabh">
          <el-input v-model="form.rsdabh" placeholder="请输入档案编号" />
        </el-form-item>
        <el-form-item label="紧急联系电话" prop="rsjjlxdh">
          <el-input v-model="form.rsjjlxdh" placeholder="请输入紧急联系电话" />
        </el-form-item>
        <el-form-item label="特长" prop="rstch">
          <el-input v-model="form.rstch" placeholder="请输入特长" />
        </el-form-item>
        <el-form-item label="个人喜好" prop="rsgrxh">
          <el-input v-model="form.rsgrxh" placeholder="请输入个人喜好" />
        </el-form-item>
        <el-form-item label="婚姻状况" prop="rshyzhk">
          <el-input v-model="form.rshyzhk" placeholder="请输入婚姻状况" />
        </el-form-item>
        <el-form-item label="简历" prop="rsjl">
          <el-input v-model="form.rsjl" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="离职日期" prop="rslzrq">
          <el-input v-model="form.rslzrq" placeholder="请输入离职日期" />
        </el-form-item>
        <el-form-item label="离职原因" prop="rslzyy">
          <el-input v-model="form.rslzyy" placeholder="请输入离职原因" />
        </el-form-item>
        <el-form-item label="状态" prop="rszht">
          <el-input v-model="form.rszht" placeholder="请输入状态" />
        </el-form-item>
        <el-form-item label="岗位内码" prop="gwid">
          <el-input v-model="form.gwid" placeholder="请输入岗位内码" />
        </el-form-item>
        <el-form-item label="驾驶证档案号" prop="Rsjshzhid">
          <el-input v-model="form.Rsjshzhid" placeholder="请输入驾驶证档案号" />
        </el-form-item>
        <el-form-item label="准驾车型" prop="Rszhjchx">
          <el-input v-model="form.Rszhjchx" placeholder="请输入准驾车型" />
        </el-form-item>
        <el-form-item label="驾驶证初领日期" prop="Rsjshzhchlrq">
          <el-input v-model="form.Rsjshzhchlrq" placeholder="请输入驾驶证初领日期" />
        </el-form-item>
        <el-form-item label="驾驶证有效日期" prop="Rsjshzhyxrq">
          <el-input v-model="form.Rsjshzhyxrq" placeholder="请输入驾驶证有效日期" />
        </el-form-item>
        <el-form-item label="驾驶证审验日期" prop="Rsjshzhshyrq">
          <el-input v-model="form.Rsjshzhshyrq" placeholder="请输入驾驶证审验日期" />
        </el-form-item>
        <el-form-item label="是否发工资" prop="isGz">
          <el-input v-model="form.isGz" placeholder="请输入是否发工资" />
        </el-form-item>
        <el-form-item label="最后更新时间" prop="lastmodifytime">
          <el-input v-model="form.lastmodifytime" placeholder="请输入最后更新时间" />
        </el-form-item>
        <el-form-item label="户口性质" prop="hkxzh">
          <el-input v-model="form.hkxzh" placeholder="请输入户口性质" />
        </el-form-item>
        <el-form-item label="户口所在地" prop="hkszd">
          <el-input v-model="form.hkszd" placeholder="请输入户口所在地" />
        </el-form-item>
        <el-form-item label="对方标识" prop="duifbsh">
          <el-input v-model="form.duifbsh" placeholder="请输入对方标识" />
        </el-form-item>
        <el-form-item label="工资发放比例" prop="PerSalary">
          <el-input v-model="form.PerSalary" placeholder="请输入工资发放比例" />
        </el-form-item>
        <el-form-item label="试用期结束日期" prop="ProbEndDate">
          <el-input v-model="form.ProbEndDate" placeholder="请输入试用期结束日期" />
        </el-form-item>
        <el-form-item label="试用期开始日期" prop="ProbStartDate">
          <el-input v-model="form.ProbStartDate" placeholder="请输入试用期开始日期" />
        </el-form-item>
        <el-form-item label="紧急联系人" prop="rsjjlxr">
          <el-input v-model="form.rsjjlxr" placeholder="请输入紧急联系人" />
        </el-form-item>
        <el-form-item label="介绍人" prop="rsjshr">
          <el-input v-model="form.rsjshr" placeholder="请输入介绍人" />
        </el-form-item>
        <el-form-item label="与介绍人关系" prop="rsjshrgx">
          <el-input v-model="form.rsjshrgx" placeholder="请输入与介绍人关系" />
        </el-form-item>
        <el-form-item label="调分公司时间" prop="ToBranchTime">
          <el-input v-model="form.ToBranchTime" placeholder="请输入调分公司时间" />
        </el-form-item>
        <el-form-item label="职级id 标识ZHJ" prop="zhjid">
          <el-input v-model="form.zhjid" placeholder="请输入职级id 标识ZHJ" />
        </el-form-item>
        <el-form-item label="职务id" prop="zhwid">
          <el-input v-model="form.zhwid" placeholder="请输入职务id" />
        </el-form-item>
        <el-form-item label="简历编号" prop="zpjlbh">
          <el-input v-model="form.zpjlbh" placeholder="请输入简历编号" />
        </el-form-item>
        <el-form-item label="使用随机密码" prop="sysjmm">
          <el-input v-model="form.sysjmm" placeholder="请输入使用随机密码" />
        </el-form-item>
        <el-form-item label="已上交" prop="yishj">
          <el-input v-model="form.yishj" placeholder="请输入已上交" />
        </el-form-item>
        <el-form-item label="是否变动" prop="isBiand">
          <el-input v-model="form.isBiand" placeholder="请输入是否变动" />
        </el-form-item>
        <el-form-item label="文化程度" prop="culture">
          <el-input v-model="form.culture" placeholder="请输入文化程度" />
        </el-form-item>
        <el-form-item label="是否拣货员" prop="isJhy">
          <el-input v-model="form.isJhy" placeholder="请输入是否拣货员" />
        </el-form-item>
        <el-form-item label="是否主动补货" prop="isSj">
          <el-input v-model="form.isSj" placeholder="请输入是否主动补货" />
        </el-form-item>
        <el-form-item label="是否送货" prop="isSongh">
          <el-input v-model="form.isSongh" placeholder="请输入是否送货" />
        </el-form-item>
        <el-form-item label="PDA密码" prop="pdamm">
          <el-input v-model="form.pdamm" placeholder="请输入PDA密码" />
        </el-form-item>
        <el-form-item label="是否变动_临时字段" prop="isBiandTmp">
          <el-input v-model="form.isBiandTmp" placeholder="请输入是否变动_临时字段" />
        </el-form-item>
        <el-form-item label="仅使用指纹" prop="onlyfinger">
          <el-input v-model="form.onlyfinger" placeholder="请输入仅使用指纹" />
        </el-form-item>
        <el-form-item label="部门名称" prop="bm">
          <el-input v-model="form.bm" placeholder="请输入部门名称" />
        </el-form-item>
        <el-form-item label="收款员余额" prop="shkyye">
          <el-input v-model="form.shkyye" placeholder="请输入收款员余额" />
        </el-form-item>
        <el-form-item label="折扣范围" prop="zkscope">
          <el-input v-model="form.zkscope" placeholder="请输入折扣范围" />
        </el-form-item>
        <el-form-item label="是否保管员" prop="isbgy">
          <el-input v-model="form.isbgy" placeholder="请输入是否保管员" />
        </el-form-item>
        <el-form-item label="是否复核/检验" prop="isfhjy">
          <el-input v-model="form.isfhjy" placeholder="请输入是否复核/检验" />
        </el-form-item>
        <el-form-item label="应收余额" prop="yshye">
          <el-input v-model="form.yshye" placeholder="请输入应收余额" />
        </el-form-item>
        <el-form-item label="销售信贷额" prop="xsxde">
          <el-input v-model="form.xsxde" placeholder="请输入销售信贷额" />
        </el-form-item>
        <el-form-item label="销售信贷期" prop="xdqxx">
          <el-input v-model="form.xdqxx" placeholder="请输入销售信贷期" />
        </el-form-item>
        <el-form-item label="复核台号" prop="fhth">
          <el-input v-model="form.fhth" placeholder="请输入复核台号" />
        </el-form-item>
        <el-form-item label="是否复核员" prop="isFhy">
          <el-input v-model="form.isFhy" placeholder="请输入是否复核员" />
        </el-form-item>
        <el-form-item label="是否PDA操作员" prop="isPda">
          <el-input v-model="form.isPda" placeholder="请输入是否PDA操作员" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listStaff, getStaff, delStaff, addStaff, updateStaff } from "@/api/flow/staff";
import {listMenu} from "@/api/system/menu";
import {addUploadCategory, listUploadCategory, updateUploadCategory} from "@/api/flow/piclist";
import {listCategory} from "@/api/pic/category";

export default {
  name: "Staff",
  dicts: ['flow_beactive_status'],
  data() {
    return {
      // 菜单树选项
      menuOptions: [],
      //图片分类
      queryParamPicFl:{
        pageNum: 1,
        pageSize: 10,
        menuId: 1107,////菜单id,当前界面固定为1107,代表职员信息界面
        menuName: null
      },
      dictA:[
        {
          label:'通知',
          value:1
        },
        {
          label:'公告',
          value:2
        }
      ],
      // 是否显示图片管理弹出层
      open2: false,
      // 图片管理表单参数
      form2: {},
      // 图片管理表单校验
      rules2: {
      },
      queryParamsPic: {
        pageNum: 1,
        pageSize: 10,
        moduleId: 1107,//菜单id,当前界面固定为1107,代表职员信息界面
        categoryId: null,//图片分类id,
        picUrl: null,//图片地址
        asId: null,//商品id,实际值为对应选中商品的goodscode
      },
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 职员信息表格数据
      staffList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        dzyid: null,
        dzycode: null,
        dzyname: null,
        lgnname: null,
        shjbumen: null,
        beactive: null,
        csrq: null,
        aged: null,
        idcard: null,
        sexid: null,
        rsmz: null,
        telephoneno: null,
        rszhzhmm: null,
        rsmail: null,
        rsjg: null,
        rshyzhk: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询菜单下拉树结构 */
    // getTreeselect() {
    //   listMenu().then(response => {
    //     this.menuOptions = [];
    //     const menu = { menuId: 0, menuName: '主类目', children: [] };
    //     menu.children = this.handleTree(response.data, "menuId");
    //     this.menuOptions.push(menu);
    //     console.log('菜单树',this.menuOptions)
    //   });
    // },
    //确定按钮(附带保存图片数据至图片管理)
    submitForm2(){
      //条件判断
      if(this.queryParamsPic.noticeType==null){this.$modal.msgError("请先选择分类");return;}
      if(this.form2.picUrl==null){this.$modal.msgError("请先上传图片");return}
      //执行
      if(this.form2.id==null){//如果没数据,新增图片管理的数据
        console.log('新增form',this.form2)
        this.form2.moduleId=1107//菜单id
        this.form2.asId=this.queryParamsPic.asId//商品编号
        this.form2.categoryId=this.queryParamsPic.categoryId//商品分类
        // this.form2.picUrl=154//图片路径
        addUploadCategory(this.form2).then(response => {
          this.$modal.msgSuccess("新增成功");
          this.open2 = false;
          this.getList();
          this.reset();
        });
      }else {//如果有数据,修改图片管理
        console.log('修改form',this.form2)
        updateUploadCategory(this.form2).then(response => {
          this.$modal.msgSuccess("修改成功");
          this.open2 = false;//弹窗隐藏
          this.getList();
          this.reset();
        });
      }
    },
    //图片上传功能弹窗显示
    handlePicture(row){
      this.reset();
      console.log('row',row)
      this.queryParamsPic.asId=row.dzyid//先确定商品id(商品编号)

      listCategory(this.queryParamPicFl).then(response => {
        console.log('图片分类返回数据',response)
        this.dictA=[]
        for (let i=0;i<response.rows.length;i++){//录入分类数据
          this.dictA.push({label:response.rows[i].picName, value:response.rows[i].picId})
        }
        this.open2 = true;//图片弹窗显示
        this.title = "图片管理";
      });
    },
    //图片分类选择事件+图片查询
    picFlClick(index){
      console.log('图片分类',index,index>0)
      console.log('图片分类2',this.queryParamsPic)
      if(index>0){
        this.queryParamsPic.categoryId=index//绑定选中的商品分类
        //图片查询
        listUploadCategory(this.queryParamsPic).then(response => {
          console.log('form',response)
          console.log('form2',)
          if(response.rows.length>0){//如果有数据
            this.form2 = response.rows[0];
          }else {
            this.form2 = {
              id: null,
              moduleId: null,
              categoryId: null,
              picUrl: null,
              asId: null
            };
          }

        });
      }
    },
    /** 查询职员信息列表 */
    getList() {
      this.loading = true;
      listStaff(this.queryParams).then(response => {
        this.staffList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.open2 = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        dzyid: null,
        dzycode: null,
        dzyname: null,
        zjm: null,
        kl: null,
        lgnname: null,
        shjbumen: null,
        beactive: null,
        issp: null,
        isSky: null,
        isCzy: null,
        isYwy: null,
        isBhy: null,
        csrq: null,
        aged: null,
        idcard: null,
        zyzw: null,
        zyzc: null,
        zyzy: null,
        sexid: null,
        callnum: null,
        zyphone: null,
        zyaddress: null,
        bysj: null,
        byxx: null,
        beizhu: null,
        isJsy: null,
        enname: null,
        cengyongming: null,
        bmid: null,
        rsgzdd: null,
        rschbzhx: null,
        rsjb: null,
        rsnshdd: null,
        rsmz: null,
        rsshg: null,
        rstzh: null,
        rsxx: null,
        rszgxl: null,
        telephoneno: null,
        rsfjh: null,
        rszhzhmm: null,
        rszjxy: null,
        rsqtlxfsh: null,
        rsnbmail: null,
        rsmail: null,
        rscjgzshj: null,
        rsjbqyshj: null,
        rsshf: null,
        rshkxzh: null,
        rsjg: null,
        rsrtshj: null,
        rsrdshj: null,
        rsdp: null,
        rsdabh: null,
        rsjjlxdh: null,
        rstch: null,
        rsgrxh: null,
        rshyzhk: null,
        rsjl: null,
        rslzrq: null,
        rslzyy: null,
        rsxp: null,
        rszht: null,
        gwid: null,
        Rsjshzhid: null,
        Rszhjchx: null,
        Rsjshzhchlrq: null,
        Rsjshzhyxrq: null,
        Rsjshzhshyrq: null,
        isGz: null,
        lastmodifytime: null,
        hkxzh: null,
        hkszd: null,
        duifbsh: null,
        ClerkType: null,
        PerSalary: null,
        ProbEndDate: null,
        ProbStartDate: null,
        ProbType: null,
        rsjjlxr: null,
        rsjshr: null,
        rsjshrgx: null,
        ToBranchTime: null,
        zhjid: null,
        zhwid: null,
        zpjlbh: null,
        sysjmm: null,
        yishj: null,
        isBiand: null,
        culture: null,
        isJhy: null,
        isSj: null,
        isSongh: null,
        pdamm: null,
        isBiandTmp: null,
        onlyfinger: null,
        bm: null,
        shkyye: null,
        zkscope: null,
        isbgy: null,
        isfhjy: null,
        yshye: null,
        xsxde: null,
        xdqxx: null,
        fhth: null,
        isFhy: null,
        isPda: null
      };
      this.form2 = {
        id: null,
        moduleId: null,
        categoryId: null,
        picUrl: null,
        asId: null
      };
      this.$set(this.form,'value','')
      this.queryParamsPic.noticeType=null
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.dzyid)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加职员信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const dzyid = row.dzyid || this.ids
      getStaff(dzyid).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改职员信息";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.dzyid != null) {
            updateStaff(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addStaff(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const dzyids = row.dzyid || this.ids;
      this.$modal.confirm('是否确认删除职员信息编号为"' + dzyids + '"的数据项？').then(function() {
        return delStaff(dzyids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('flow/staff/export', {
        ...this.queryParams
      }, `staff_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
